package com.bootdo.xiao.suggest;

/**
 * @Auther: liuj
 * @Date: 2019/5/27 15:47
 * @Description: 建议6：警惕自增的陷阱
 */
public class Suggest6 {
    public static void main(String[] args){
        //向上转型
        Base b = new Sub();
        b.fun("liujia", 5);
        //向下转型
        Sub s = new Sub();
        //编译不通过，编译器不能把5转换为数组对象
//        s.fun("liujia", 5);
    }
}


class Base{
    void fun(String str, int...nums){
        System.out.println("Base.fun.......");
    }
}

class Sub extends Base{
    @Override
    void fun(String str, int[] nums){
        System.out.println("Sub.fun.......");
    }
}
